package main

import (
	"fmt"
	"time"
)

// var wg = sync.WaitGroup{}

func main() {
	st := int(time.Now().Unix())
	var chan1 chan int = make(chan int, 100)
	var chan2 chan int = make(chan int, 100)

	for i := 1; i <= 10; i++ {
		chan1 <- i
		time.Sleep(time.Second * 1)
	}

	x := 0
	for i := 1; i <= 10; i++ {
		x = <-chan1
		chan2 <- x * x
		time.Sleep(time.Second * 1)
	}

	for i := 1; i <= 10; i++ {
		fmt.Printf("%v ", <-chan2)
		time.Sleep(time.Second * 1)
	}

	fmt.Printf("\n")

	fmt.Println("use_time：", int(time.Now().Unix())-st)
}
